package service

import (
	"context"
	"fmt"
	__ "user-srv/basic/proto"
	"user-srv/handler/dao"
	"user-srv/pkg"
)

// 续费添加
func (s *Server) MemberServiceAdd(_ context.Context, in *__.MemberServiceAddReq) (*__.MemberServiceAddResp, error) {
	add, err := dao.MemberServiceAdd(in)
	if err != nil {
		return nil, err
	}

	return &__.MemberServiceAddResp{
		Id:      add.Id,
		OrderOr: add.OrderOr,                                           //订单编号
		Amount:  float32(add.Amount),                                   //续费金额
		PayUrl:  pkg.Pay(add.OrderOr, fmt.Sprintf("%.2f", add.Amount)), //支付连接
	}, nil
}
